package com.cskaoyan.market.admin.service.impl;

import com.cskaoyan.market.admin.service.MarketSearchHistoryService;
import com.cskaoyan.market.db.domain.MarketSearchHistory;
import com.cskaoyan.market.db.domain.MarketSearchHistoryExample;
import com.cskaoyan.market.db.mapper.MarketSearchHistoryMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yuanixn2158@163.com
 * @since 2023/05/09 10:48
 */
@Service
public class MarketSearchHistoryServiceImpl implements MarketSearchHistoryService {
    @Autowired
    private MarketSearchHistoryMapper searchHistoryMapper;
    @Override
    public List<MarketSearchHistory> getSearchHistoryList(Integer page, Integer limit, String sort, String order) {

        MarketSearchHistoryExample marketSearchHistoryExample = new MarketSearchHistoryExample();
        marketSearchHistoryExample.orderBy(sort+" "+order);
        PageHelper.startPage(page,limit);
        List<MarketSearchHistory> marketSearchHistories = searchHistoryMapper.selectByExample(marketSearchHistoryExample);
        return marketSearchHistories;
    }
}
